package com.sqk.dxpro.dxclear;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider.Text;

public class DxClearMain {
	
	public static void main(String[] args )throws IOException,ClassNotFoundException,InterruptedException
	{	
		System.setProperty("hadoop.home.dir", "F:\\Configuration\\hadoop-2.6.0");
		
		Configuration conf = new Configuration();
		conf.set("mapreduce.map.memory.mb","2048");
		Job job = Job.getInstance(conf);
		job.setJarByClass(DxClearMain.class);
		job.setMapperClass(DxClearMapper.class);
		job.setNumReduceTasks(0);
		
		job.setOutputKeyClass(NullWritable.class);
		job.setOutputValueClass(Text.class);
		
		TextInputFormat.setMinInputSplitSize(job,1024*1024*64L);
		TextInputFormat.setMaxInputSplitSize(job,1024*1024*128L);
		FileInputFormat.addInputPath(job,new Path("F:\\SparkTask\\data\\dxdata.txt"));
		FileOutputFormat.setOutputPath(job,new Path("F:\\SparkTask\\DxClear"));
		
		System.exit(job.waitForCompletion(true) ? 0 : 1);
	}

}
